﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <WtmSearcher v-model="searchDataRouteOperation" @search="()=>{getTableDataRouteOperation();}">
      <el-row>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="AddTime_FormItem" prop="AddTime" :label="$t('message.autotrans._Model_RouteOperation_AddTime')">
            <el-date-picker v-model="searchDataRouteOperation.AddTime" type='daterange' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="EditTime_FormItem" prop="EditTime" :label="$t('message.autotrans._Model_RouteOperation_EditTime')">
            <el-date-picker v-model="searchDataRouteOperation.EditTime" type='daterange' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="LastOperationCode_FormItem" prop="LastOperationCode" :label="$t('message.autotrans._Model_RouteOperation_LastOperationCode')">
            <el-input v-model="searchDataRouteOperation.LastOperationCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="LineCode_FormItem" prop="LineCode" :label="$t('message.autotrans._Model_RouteOperation_LineCode')">
            <el-input v-model="searchDataRouteOperation.LineCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="NextNode_FormItem" prop="NextNode" :label="$t('message.autotrans._Model_RouteOperation_NextNode')">
            <el-input v-model="searchDataRouteOperation.NextNode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="NextOperationCode_FormItem" prop="NextOperationCode" :label="$t('message.autotrans._Model_RouteOperation_NextOperationCode')">
            <el-input v-model="searchDataRouteOperation.NextOperationCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="NextOperationId_FormItem" prop="NextOperationId" :label="$t('message.autotrans._Model_RouteOperation_NextOperationId')">
            <el-input v-model="searchDataRouteOperation.NextOperationId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="OperationCode_FormItem" prop="OperationCode" :label="$t('message.autotrans._Model_RouteOperation_OperationCode')">
            <el-input v-model="searchDataRouteOperation.OperationCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="OperationId_FormItem" prop="OperationId" :label="$t('message.autotrans._Model_RouteOperation_OperationId')">
            <el-input v-model="searchDataRouteOperation.OperationId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="OperationName_FormItem" prop="OperationName" :label="$t('message.autotrans._Model_RouteOperation_OperationName')">
            <el-input v-model="searchDataRouteOperation.OperationName" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="OrderCode_FormItem" prop="OrderCode" :label="$t('message.autotrans._Model_RouteOperation_OrderCode')">
            <el-input v-model="searchDataRouteOperation.OrderCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="OrderId_FormItem" prop="OrderId" :label="$t('message.autotrans._Model_RouteOperation_OrderId')">
            <el-input v-model="searchDataRouteOperation.OrderId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="ParentOperationCode_FormItem" prop="ParentOperationCode" :label="$t('message.autotrans._Model_RouteOperation_ParentOperationCode')">
            <el-input v-model="searchDataRouteOperation.ParentOperationCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="ParentOperationId_FormItem" prop="ParentOperationId" :label="$t('message.autotrans._Model_RouteOperation_ParentOperationId')">
            <el-input v-model="searchDataRouteOperation.ParentOperationId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="RouteName_FormItem" prop="RouteName" :label="$t('message.autotrans._Model_RouteOperation_RouteName')">
            <el-input v-model="searchDataRouteOperation.RouteName" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="RouteNumber_FormItem" prop="RouteNumber" :label="$t('message.autotrans._Model_RouteOperation_RouteNumber')">
            <el-input v-model="searchDataRouteOperation.RouteNumber" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="RouteVersion_FormItem" prop="RouteVersion" :label="$t('message.autotrans._Model_RouteOperation_RouteVersion')">
            <el-input v-model="searchDataRouteOperation.RouteVersion" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="ScheduleNumber_FormItem" prop="ScheduleNumber" :label="$t('message.autotrans._Model_RouteOperation_ScheduleNumber')">
            <el-input v-model="searchDataRouteOperation.ScheduleNumber" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="Sort_FormItem" prop="Sort" :label="$t('message.autotrans._Model_RouteOperation_Sort')">
            <el-input v-model="searchDataRouteOperation.Sort" clearable></el-input>
        </el-form-item>

        </el-col>
      </el-row>

  </WtmSearcher>

  <div style="text-align: right;">
      <WtmButton v-auth="'/api/BaseInformation/RouteOperation/Create'" icon='fa fa-plus' type='primary' :button-text="$t('message.autotrans.SysCreate')" @click="OnCreateClick()"/>
    <WtmButton v-auth="'/api/BaseInformation/RouteOperation/BatchDelete'"  icon='fa fa-trash' type='danger' :button-text="$t('message.autotrans.SysDelete')" :confirm="$t('message._system.common.vm.deletetip')" @click="onBatchDelete()"/>
    <WtmButton v-auth="'/api/BaseInformation/RouteOperation/BatchEdit'" icon='fa fa-pencil-square' type='primary' :button-text="$t('message.autotrans.SysBatchEdit')" @click="OnBatchEditClick()"/>
    <WtmButton v-auth="'/api/BaseInformation/RouteOperation/Import'" icon='fa fa-tasks' type='primary' :button-text="$t('message.autotrans.SysImport')" @click="OnImportClick()"/>
    <WtmButton v-auth="'/api/BaseInformation/RouteOperation/RouteOperationExportExcel'"  icon='fa fa-arrow-circle-down' type='primary' :button-text="$t('message.autotrans.SysExport')" @click="onExport()"/>

  </div>
  <WtmTable ref="tableRefRouteOperation" v-bind="tableDataRouteOperation">
    <template #operation>
      <el-table-column :label="$t('message._system.common.vm.operate')" width="180">
        <template v-slot="scope">
            <WtmButton v-auth="'/api/BaseInformation/RouteOperation/Edit'" :is-text="true" icon='fa fa-pencil-square' type='warning' :button-text="$t('message.autotrans.SysEdit')" @click="OnEditrowClick(scope.row)"/>
          <WtmButton v-auth="'/api/BaseInformation/RouteOperation/{id}'" :is-text="true" icon='fa fa-info-circle' type='info' :button-text="$t('message.autotrans.Page详情')" @click="OnDetailsrowClick(scope.row)"/>
          <WtmButton v-auth="'/api/BaseInformation/RouteOperation/BatchDelete'"  icon='fa fa-trash' type='danger' :button-text="$t('message.autotrans.SysDelete')" :confirm="$t('message._system.common.vm.deletetip')" :is-text="true"  @click="onDelete(scope.row)"/>

        </template>
      </el-table-column>
    </template>
  </WtmTable>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageBaseInformationRouteOperationIndex;true;TyMES.BaseInformation.Controllers;RouteOperation">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { routeoperationApi } from '/@/api/baseinformation/routeoperation';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;

const CreateDialog = defineAsyncComponent(() => import('./create.vue'));
const EditDialog = defineAsyncComponent(() => import('./edit.vue'));
const DetailsDialog = defineAsyncComponent(() => import('./details.vue'));
const BatchEditDialog = defineAsyncComponent(() => import('./batchedit.vue'));
const ImportDialog = defineAsyncComponent(() => import('./import.vue'));

const stateRouteOperation = reactive({
    
});

const searchDataRouteOperation = ref({
        AddTime: undefined,
        EditTime: undefined,
        LastOperationCode: '',
        LineCode: '',
        NextNode: '',
        NextOperationCode: '',
        NextOperationId: '',
        OperationCode: '',
        OperationId: '',
        OperationName: '',
        OrderCode: '',
        OrderId: '',
        ParentOperationCode: '',
        ParentOperationId: '',
        RouteName: '',
        RouteNumber: '',
        RouteVersion: '',
        ScheduleNumber: '',
        Sort: '',
});

// 定义变量内容
const tableRefRouteOperation = ref();
const tableDataRouteOperation = ref({
    // 列表数据（必传）
    data: [],
	// 表头内容（必传，注意格式）
	header: [
      {title:ci.proxy.$t('message.autotrans.Page添加时间'),key: 'RouteOperation_AddTime',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page编辑时间'),key: 'RouteOperation_EditTime',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page前工序编码'),key: 'RouteOperation_LastOperationCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page产线编码'),key: 'RouteOperation_LineCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page下一个节点'),key: 'RouteOperation_NextNode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page后工序编码'),key: 'RouteOperation_NextOperationCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page后工序ID'),key: 'RouteOperation_NextOperationId',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page工序编码'),key: 'RouteOperation_OperationCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page工序ID'),key: 'RouteOperation_OperationId',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page工序名称'),key: 'RouteOperation_OperationName',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page工单编号'),key: 'RouteOperation_OrderCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page工单ID'),key: 'RouteOperation_OrderId',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page父工序编码'),key: 'RouteOperation_ParentOperationCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page父工序ID'),key: 'RouteOperation_ParentOperationId',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page工艺路线名称'),key: 'RouteOperation_RouteName',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page工艺路线编号'),key: 'RouteOperation_RouteNumber',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page工艺路线版本'),key: 'RouteOperation_RouteVersion',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page排程编号'),key: 'RouteOperation_ScheduleNumber',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page排序'),key: 'RouteOperation_Sort',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans._AdminIsValid'),key: 'RouteOperation_IsValid',type: 'switch',isCheck: true},

	],
	// 配置项（必传）
	config: {
        total: 0, // 列表总数
		loading: true, // loading 加载
		isSerialNo: true, // 是否显示表格序号
		isSelection: true, // 是否显示表格多选
		isOperate: true, // 是否显示表格操作栏
	}
});
// 初始化表格数据
const getTableDataRouteOperation = () => {
    tableRefRouteOperation.value.doSearch(routeoperationApi().search, searchDataRouteOperation.value)
        .catch((error: any) => {
			other.setFormError(ci, error);
		});
};
const OnCreateClick = () => {
    other.openDialog(ci.proxy.$t('message.autotrans.SysCreate'), CreateDialog, null, getTableDataRouteOperation)
};

const OnEditrowClick = (row: any) => {
    other.openDialog(ci.proxy.$t('message.autotrans.SysEdit'), EditDialog, row, getTableDataRouteOperation)
};

const OnDetailsrowClick = (row: any) => {
    other.openDialog(ci.proxy.$t('message.autotrans.Page详情'), DetailsDialog, row, getTableDataRouteOperation)
};

// 删除
const onDelete = (row: any) => {
    routeoperationApi().delete([row.ID]).then(() => { getTableDataRouteOperation()})
};

const onBatchDelete = () => {
    const selectedrows = tableRefRouteOperation.value.getSelectedRows();
    const selectedids = selectedrows.map((x: any) => x.ID);
    if (selectedids.length > 0)
      routeoperationApi().delete(selectedids).then(() => { getTableDataRouteOperation()})
    else
      ElMessage.error(ci.proxy.$t('message._system.common.vm.check'));
};

const OnBatchEditClick = () => {
    const selectedrows = tableRefRouteOperation.value.getSelectedRows();
    const selectedids = selectedrows.map((x: any) => x.ID);
    if (selectedids.length > 0)
      other.openDialog(ci.proxy.$t('message.autotrans.SysBatchEdit'), BatchEditDialog, selectedids, getTableDataRouteOperation)
    else
      ElMessage.error(ci.proxy.$t('message._system.common.vm.check'));
};

const OnImportClick = () => {
    other.openDialog(ci.proxy.$t('message.autotrans.SysImport'), ImportDialog, null, getTableDataRouteOperation)
};

const onExport = () => {
	const selected = tableRefRouteOperation.value.getSelectedRows();
	if (selected.length > 0) {
		routeoperationApi().exportById(selected.map((x: any) => x.ID));
	}
	else {
		routeoperationApi().export({});
	}
};

// 页面加载时
onMounted(() => {
    
        getTableDataRouteOperation();

});

// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

